package cn.itcast.order.service.impl;

import cn.itcast.order.mapper.OrderMapper;
import cn.itcast.order.pojo.Order;
import cn.itcast.order.service.OrderService;
import pojo.User;
import service.UserClient;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author: duk
 * @Date: 2022/1/8 12:57
 * @Description: 订单实现
 */
@Service
public class OrderServiceImpl implements OrderService {
    @Resource
    private OrderMapper orderMapper;
    @Resource
    private UserClient userClient;

    @Override
    public Order queryOrderById(Long orderId) {
        // 1.查询订单
        Order order = orderMapper.findById(orderId);
        //2.人员信息查询地址
        User user = userClient.findById(order.getUserId());
        order.setUser(user);
        // 4.返回
        return order;
    }
}
